package Thread.Thread_Pool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Executors 创建线程池的四种方式
 */
public class PoolCreateMethod {
    public static void main(String[] args) {
        //固定大小的线程池
        ExecutorService pool1= Executors.newFixedThreadPool(10);
        //数量动态变化的线程池
        ExecutorService pool2=Executors.newCachedThreadPool();
        //只包含一个线程的单线程池
        ExecutorService pool3=Executors.newSingleThreadExecutor();
        //定期线程池，可以设置任务的延时启动时间
        ExecutorService pool4=Executors.newScheduledThreadPool(10);
    }
}
